
import 'package:chang_zhan/hotel_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';


class  HotelCarousel extends StatelessWidget{
  @override
  Widget build(BuildContext context){
    return Column(
            children: <Widget>[
            Padding(
              padding:  EdgeInsets.symmetric(horizontal:20.0),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                Text('高级旅馆',
                style:TextStyle(fontSize: 22.0,
                fontWeight:FontWeight.bold,
                letterSpacing: 1.5,
                )
                ),
                GestureDetector(
                  onTap: () => print('看到一切'),

                 child: Text('看到一切',
                  style: TextStyle(
                    color:Theme.of(context).primaryColor,
                    fontSize: 16.0,
                    fontWeight: FontWeight.w600,
                    letterSpacing: 1.0,
                  ),
                  ),
                )
              ],),
            ),
            Container(
              height:300.0,
              
              child:ListView.builder(
                scrollDirection: Axis.horizontal,
                itemCount: hotels.length,
                itemBuilder: (BuildContext context, int index){
                 Hotel hotel = hotels[index];
                  return Container(
                    margin: EdgeInsets.all(10.0),
                    width: 240.0,
                    
                    child: Stack(
                      alignment: Alignment.topCenter,
                      children: <Widget>[
                       Positioned(
                       bottom:15.0,
                        child: Container(
                         height:120.0,
                         width:240.0,
                         decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.circular(10.0)
                         ),
                         child: Padding(
                           padding: EdgeInsets.all(10.0),
                           child: Column(
                             mainAxisAlignment: MainAxisAlignment.end,
                           
                             children:<Widget>[
                               Text(
                                 hotel.name,
                               style: TextStyle(
                                 fontSize:22.0,
                                 fontWeight:FontWeight.w600,
                                 letterSpacing: 1.2,
                               ),
                               ),
                               SizedBox(height:2.0),
                               Text(
                                 hotel.address,
                               style: TextStyle(
                                 color:Colors.grey,
                               ),
                               ),
                               SizedBox(height:2.0),
                               Text('\$${hotel.price} / night',
                               style: TextStyle(
                                 fontSize: 18.0,
                                 fontWeight:FontWeight.w600,
                                 
                               ),
                               ),
                             ]
                           ),
                         ),
                       ),
                     ),
                     Container(
                       decoration: BoxDecoration(
                         color: Colors.white,
                         borderRadius: BorderRadius.circular(20.0),
                         boxShadow: [
                           BoxShadow(
                             color: Colors.black26,
                             offset: Offset(0.0, 0.2),
                             blurRadius: 6.0,
                           ),
                         ],
                          ),
                          child: 
                            ClipRRect(
                              borderRadius: BorderRadius.circular(20.0),
                             child: Image(
                                height:180.0,
                                width:220.0,
                                image:AssetImage(hotel.imageUrl),
                                fit: BoxFit.cover,
                              ),
                            ),
                            
                          
                          
                     )
                    ]),
                  );
                })
            )
          ]
          );
  }
}